﻿using PC.PickleJar.Configuration;
using PC.PickleJar.Exceptions;
using PC.PickleJar.Helpers;
using PC.PickleJar.Trello.Configuration;
using PC.PickleJar.Validators;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PC.PickleJar.Trello.Helpers
{
	public class TrelloConfigurationHelper
	{
		private static readonly String SectionName = "pickleJar.trello";
		private NameValueCollection configSection;

		public TrelloConfigurationHelper()
		{
			this.configSection = (NameValueCollection)ConfigurationManager.GetSection(TrelloConfigurationHelper.SectionName);

			if (this.configSection == null)
			{
				throw new ConfigurationNotFoundException(TrelloConfigurationHelper.SectionName);
			}
		}

		public String UserToken
		{
			get
			{
				String result = TrelloConfigurationDefaults.UserToken;

				if (this.configSection != null)
				{
					result = this.configSection["userToken"];
				}

				return result;
			}
		}

		public string DeveloperApiKey
		{
			get
			{
				String result = TrelloConfigurationDefaults.UserToken;

				if (this.configSection != null)
				{
					result = this.configSection["developerApiKey"];
				}

				return result;
			}
		}
	}
}
